package com.xiaoyu.awakening.ai.search.core.callback;

import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch.core.SearchRequest;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.LinkedHashMap;
import java.util.List;

/**
 * @author wangxiaoyu
 * @date 2025/3/26 11:02
 * @since v1.0
 */
@Slf4j
@Component
public abstract class AbstractCallBack<T> implements IAwkCallBackRoute<T> {
    @Resource
    public ElasticsearchClient elasticsearchClient;

    public SearchRequest buildFilters(String query, LinkedHashMap<String, Object> filters, Integer top) {
        return null;
    }

    /**
     * 回调路由
     *
     * @param query   查询语句
     * @param filters 过滤条件
     * @param top     返回数量
     * @return 回调结果
     */
    @Override
    public abstract List<T> doCallBack(String query, LinkedHashMap<String, Object> filters, Integer top);
}
